package org.test.client.forcedirect;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.List;

import javax.swing.JPanel;

import org.test.client.ui.util.UIUtil;

public class MapPanel extends JPanel{
	
	private List<FDNode> nodes = null;
	private List<FDEdge> edges = null;
	
	public MapPanel(){
		
		this.setPreferredSize(new Dimension(TestMain.mapwidth, TestMain.mapheight));
		
	}
	
	
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		
		Graphics2D g2d = (Graphics2D) g;
		UIUtil.setAntiAliasing(g2d, true);
		if(nodes !=null ){
			for(FDNode node : nodes){
				node.renderNode(g2d);
			}
		}
		
		if(edges !=null ){
			for(FDEdge edge : edges){
				edge.renderEdge(g2d);
			}
		}
		
	}


	public List<FDNode> getNodes() {
		return nodes;
	}

	public void setNodes(List<FDNode> nodes) {
		this.nodes = nodes;
	}

	public List<FDEdge> getEdges() {
		return edges;
	}

	public void setEdges(List<FDEdge> edges) {
		this.edges = edges;
	}
	
	
}
